<template>
  <section>
    <!--工具条-->
    <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
      <el-form :inline="true" :model="filters">
        <el-form-item>
          <el-input v-model="filters.name" placeholder="角色名称"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" v-on:click="selectPermission">查询</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleAdd">新增</el-button>
        </el-form-item>
      </el-form>
    </el-col>
    <!--列表-->
    <el-table :data="Permission" highlight-current-row v-loading="listLoading"
              @selection-change="selsChange" style="width: 100%;">
      <el-table-column type="selection" width="55">
      </el-table-column>
      <el-table-column type="index" label="序号" width="60">
      </el-table-column>
      <el-table-column prop="name" label="角色名称" width="300">
      </el-table-column>
      <el-table-column prop="url" label="角色名称" width="300">
      </el-table-column>
      <el-table-column prop="sn" label="类型编码" >
      </el-table-column>
    </el-table>
    <!--工具条-->
    <el-col :span="24" class="toolbar">
      <el-pagination layout="prev, pager, next"
                     @current-change="handleCurrentChange"
                     :page-size="pageSize"
                     :total="totals"
                     :current-page="currentPage"
                     style="float:right;">
      </el-pagination>
    </el-col>
  </section>
</template>

<script>
import util from '../../common/js/util'
//import NProgress from 'nprogress'
import {getUserListPage, removeUser, batchRemoveUser, editUser, addUser} from '../../api/api';

export default {

  data() {
    return {
      filters: {
        name: ''
      },
      Permission: [],
      options: [],
      permissions:[],
      totals: 0,
      currentPage: 1,
      pageSize: 5,
      det_totals: 0,
      det_currentPage: 1,
      det_pageSize: 5,
      title: '',
      listLoading: false,
    }
  },
  methods: {
    selectPermission() {
      this.currentPage = 1;
      this.getPermission();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getPermission();
    },
    //获取店铺列表
    getPermission() {
      let para = {
        currentPage: this.currentPage,
        pageSize: this.pageSize,
        keyword: this.filters.name
      };
      this.listLoading = true;
      this.$http.post("/permission/pageList", para).then((res) => {
        this.Permission = res.data.data;
        this.totals = res.data.totals;
        this.listLoading = false;
      }).catch((res => {
        this.$message.error("网络繁忙");
      }));
    },

    selsChange: function (sels) {
      this.sels = sels;
    },
  },
  mounted() {
    this.getPermission();
  }
}

</script>

<style scoped>

</style>